<?php
namespace Swiftx\Bundle\WeChat\Interfaces\Factory;
use Swiftx\Bundle\WeChat\Model\User as Entity;
use Swiftx\Interfaces\Httpd\Request;

/**
 * 用户登录页面接口
 * @default-implement Swiftx\Bundle\WeChat\Factory\User singleton=true
 */
interface User {

    /**
     * 根据用户名获取用户
     * @param string $username
     * @return Entity
     */
    public function fetchByUsername(string $username);

    /**
     * 标记当前登陆用户
     * @param Request $request
     * @param Entity $user
     */
    public function registerLogin(Request $request, Entity $user);

    /**
     * 获取当前请求登陆用户
     * @param Request $request
     * @return Entity
     */
    public function currentLogin(Request $request);

}